<?php
class ErrorController extends Areal_Controller_Action {
    public function errorAction() {
        $error = $this->_getParam('error_handler');
        $this->view->exception = $error->exception;
        //$error = $this->_getParam('error_handler');
        //$this->_forward('admin-login','user','default');
        //Zend_Debug::dump($error->exception->getTrace());

        //exit('nenumatyta kalida');
/*        $error = $this->_getParam('error_handler');
        if (isset($error->exception)) switch(get_class($error->exception)) {
            case 'PageNotFoundException':
                $this->_forward('notFound');
            break;

            case 'Areal_Acl_Exception':
                $this->_forward('denied');
            break;
            default:
                $this->view->assign('error', $error);
                //put some default handling logic here
            break;
        }

        $acl_response = $this->_getParam('acl_response');
        switch ($acl_response){
            case 403:
                $this->_forward('forbidden');
            break;
            case 404:
                $this->_forward('not_found');
            break;
            case 500:
                //$this->_forward('notFound');
                //$this->_forward('internal');
            break;
        }
        $message = $this->_getParam('message');
        $this->view->message = $message;*/
    }

    /**
     * Forbidden access
     *
     * HTTP 403
     *
     * @return void
     */
    public function forbiddenAction()
    {
        // Send 403 HTTP Error
        $this->getResponse()->setRawHeader('HTTP/1.1 403 Not Found');
        $this->view->loginForm = new Default_LoginForm();
    }

    /**
     * Not-Found
     *
     * Action used when an action or controller could not be dispatched.
     * This is commonly referred to as an HTTP 404
     *
     * @return void
     */
    public function notfoundAction()
    {
        // Send 404 HTTP Error
        $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
    }

    /**
     * Internal Error
     *
     * Action used when an internal server error occured.
     * Commonly referred to as an HTTP 500
     *
     */
    public function internalAction()
    {
        // Send 500 Error
        $this->getResponse()->setRawHeader('HTTP/1.1 500 Internal Server Error');
    }
}
